<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>车型信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$('input[name=iselectric]').change(function(){
				var val = $('input[name=iselectric]:checked').val();
				if(val == "1") {
					$('#rangegrp').show();
				} else {
					$('#rangegrp').hide();
				}
			});
			$('input[name=iselectric]').change();
			//$("#name").focus();
			$("#inputForm").validate({
				rules: {
					typename: {remote: "${ctx}/rentproduct/tCargotype/checkTypename?oldTypename=" + encodeURIComponent('${tCargotype.typename}')},
				},
				messages: {
					typename: {remote: "车型名称已存在"},
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			// 座位数在1-100内
			$.validator.addMethod("num100", function(value, element) {
				if(value > 100 || value<=0){
					return false;
				} 
				return true;
			}, "座位数在1-100内");
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/rentproduct/tCargotype/">车型信息列表</a></li>
		<li class="active"><a href="${ctx}/rentproduct/tCargotype/form?cargotypeid=${tCargotype.cargotypeid}">车型信息<shiro:hasPermission name="rentproduct:tCargotype:edit">${not empty tCargotype.cargotypeid?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="rentproduct:tCargotype:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="tCargotype" action="${ctx}/rentproduct/tCargotype/save" method="post" class="form-horizontal">
		<form:hidden path="cargotypeid"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">车型LOGO:</label>
			<div class="controls">
				<form:hidden id="cartypelogo" path="cartypelogo" htmlEscape="false" maxlength="255" class="input-xlarge"/>
				<sys:ckfinder input="cartypelogo" type="images" uploadPath="/cartype" selectMultiple="false" maxWidth="100" maxHeight="100"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">车型名称：</label>
			<div class="controls">
				<form:input path="typename" htmlEscape="false" maxlength="50" class="span4 required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">可乘座位数：</label>
			<div class="controls">
				<form:input path="seats" htmlEscape="false" class="span4 required digits num100"/>
				<span class="help-inline">座（不超过100）<font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">行李箱容量：</label>
			<div class="controls">
				<form:input path="packs" htmlEscape="false" class="span4 required digits"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">车型描述：</label>
			<div class="controls">
				<form:textarea path="typedesc" rows="5" htmlEscape="false" maxlength="255" class="span4 "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">车辆类型：</label>
			<div class="controls" >
				<input type="radio" name="tstyles" value="xc" ${tCargotype.tstyles=="xc"?'checked':''}>4座小车
				<input type="radio" name="tstyles" value="swc" ${tCargotype.tstyles=="swc"?'checked':''}>6座商务车
				<input type="radio" name="tstyles" value="xb" ${tCargotype.tstyles=="xb"?'checked':''}>13座以下小巴
				<input type="radio" name="tstyles" value="zb" ${tCargotype.tstyles=="zb"?'checked':''}>24座以下中巴
				<input type="radio" name="tstyles" value="db" ${tCargotype.tstyles=="db"?'checked':''}>25座以上大巴
				<input type="radio" name="tstyles" value="hh" ${tCargotype.tstyles=="hh"?'checked':''}>豪华车
				<input type="radio" name="tstyles" value="dd" ${tCargotype.tstyles=="dd"?'checked':''}>电动车
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">是否纯电动：</label>
			<div class="controls">
				<label class="radio"><input type="radio" name="iselectric" value="1" ${tCargotype.iselectric=="1"?'checked':''}/>是</label>
				<label class="radio"><input type="radio" name="iselectric" value="0" ${tCargotype.iselectric=="0"?'checked':''}/>否</label>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group" id="rangegrp">
			<label class="control-label">续航里程：</label>
			<div class="controls">
				<form:input path="continuerange" htmlEscape="false" maxlength="50" class="span4 digits positive"/>
				<span class="help-inline">公里</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">裸车价：</label>
			<div class="controls">
				<form:input path="nudePrice" htmlEscape="false" class="span4 required money"/>
				<span class="help-inline">元<font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">油费系数：</label>
			<div class="controls">
				<form:input path="oilcost" htmlEscape="false" class="span4 required money"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">路杂系数：</label>
			<div class="controls">
				<form:input path="roadmodules" htmlEscape="false" class="span4 required money"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">超公里标准价：</label>
			<div class="controls">
				<form:input path="outkmsfee" htmlEscape="false" class="span4 required money"/>
				<span class="help-inline">元<font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">超时长标准价：</label>
			<div class="controls">
				<form:input path="outtimefee" htmlEscape="false" class="span4 required money"/>
				<span class="help-inline">元<font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">空驶费标准价：</label>
			<div class="controls">
				<form:input path="nonoccu" htmlEscape="false" class="span4 required money"/>
				<span class="help-inline">元<font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">排序：</label>
			<div class="controls">
				<form:input path="sorts" htmlEscape="false" class="span4 required number"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="rentproduct:tCargotype:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>